package com.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.service.DictionaryService;

@RestController
@RequestMapping("/api/dictionary")
public class DictionaryController {

    private final DictionaryService dictionaryService;

    public DictionaryController(DictionaryService dictionaryService) {
        this.dictionaryService = dictionaryService;
    }
  //从线上捞取数据;
    @GetMapping("/update")
    public String updateDictionary() {
        try {
            dictionaryService.updateDictionaryFromExcel();
            return "字典表更新成功";
        } catch (Exception e) {
            e.printStackTrace();
            return "字典表更新失败: " + e.getMessage();
        }
    }
}